package com.yingpai.fitness.adpter.course;

import android.app.Activity;
import android.support.annotation.LayoutRes;
import android.widget.TextView;

import com.bumptech.glide.Glide;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.yingpai.fitness.R;
import com.yingpai.fitness.entity.RunStrategyBean;

import cn.jzvd.JZVideoPlayer;
import cn.jzvd.JZVideoPlayerStandard;

public class CourseDetailVideoRecyclerAdapter extends BaseQuickAdapter<RunStrategyBean.MapBean.VideosBean, BaseViewHolder> {


    private Activity mContext;//上下文/fragment/activity


    public CourseDetailVideoRecyclerAdapter(@LayoutRes int layoutResId, Activity mContext) {
        super(layoutResId);
        this.mContext = mContext;
    }

    @Override
    protected void convert(BaseViewHolder helper, RunStrategyBean.MapBean.VideosBean item) {

        final TextView course_detail_video_title = helper.getView(R.id.course_detail_video_title);//视频名称
        course_detail_video_title.setText(item.getVideoTitle());

        JZVideoPlayerStandard video = helper.getView(R.id.video);
        video.setUp(item.getVideoUrl(), JZVideoPlayer.SCREEN_WINDOW_LIST, item.getVideoTitle());
        Glide.with(mContext)
                .load(item.getPhotoUrl())
                .centerCrop()
                .into(video.thumbImageView);

    }

}
